<table xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://xmlns.jcp.org/jsf/html" xmlns:c="http://xmlns.jcp.org/jsp/jstl/core" style="table-layout:fixed;">
    <thead>
        <c:if test="#{bnTblTrd.table.measCount>0}">
            <tr>
                <c:forEach items="#{bnTblTrd.table.HDim}" var="hd">
                    <c:if test="#{hd.showInTable}">
                        <th class="gw-th gw-pwt-th" rowspan="#{bnTblTrd.table.VDimCount + bnTblTrd.table.measCount}">#{hd.title}</th>
                    </c:if>
                </c:forEach>
                <c:forEach items="#{bnTblTrd.table.meas}" var="m">
                    <c:if test="#{m.showInTable}">
                        <th class="gw-th gw-pwt-th" colspan="#{m.colspan}">#{m.title}</th>
                    </c:if>
                </c:forEach>
                <c:if test="#{bnTblTrd.table.showRightHeader}">
                    <c:forEach items="#{bnTblTrd.table.HDimReverse}" var="hd">
                        <c:if test="#{hd.showInTable}">
                            <th class="gw-th gw-pwt-th" rowspan="#{bnTblTrd.table.VDimCount + bnTblTrd.table.measCount}">#{hd.title}</th>
                        </c:if>
                    </c:forEach>
                </c:if>
            </tr>
        </c:if>
        <c:forEach items="#{bnTblTrd.table.VDim}" var="vd">
            <tr>
                <c:if test="#{bnTblTrd.table.measCount==0 and vd.index==0}">
                    <c:forEach items="#{bnTblTrd.table.HDim}" var="hd">
                        <c:if test="#{hd.showInTable}">
                            <th class="gw-th gw-pwt-th" rowspan="#{bnTblTrd.table.VDimCount + bnTblTrd.table.measCount}">#{hd.title}</th>
                        </c:if>
                    </c:forEach>
                </c:if>
                <c:forEach items="#{vd.iterator}">
                    <c:forEach items="#{vd.values}" var="vdv">
                        <th class="gw-th gw-pwt-th" colspan="#{vdv.colspan}">#{vdv.name}</th>
                    </c:forEach>
                </c:forEach>
                <c:if test="#{bnTblTrd.table.showRightHeader}">
                    <c:if test="#{bnTblTrd.table.measCount==0 and vd.index==0}">
                        <c:forEach items="#{bnTblTrd.table.HDimReverse}" var="hd">
                            <c:if test="#{hd.showInTable}">
                                <th class="gw-th gw-pwt-th" rowspan="#{bnTblTrd.table.VDimCount + bnTblTrd.table.measCount}">#{hd.title}</th>
                            </c:if>
                        </c:forEach>
                    </c:if>
                </c:if>
            </tr>
        </c:forEach>
    </thead>
    <tbody>
        <c:forEach items="#{bnTblTrd.table.rows}" var="r">
            <tr class="gw-pwt-tr">
                <c:forEach items="#{r.HDimCells}" var="c">
                    <c:if test="#{c.visible}">
                        <td class="tdd lvl#{c.dim.level} tdsl#{c.row.selected} #{c.dim.tableDimension.css}" rowspan="#{c.dim.rowspan}"><c:if test="#{c.dim.tableDimension.showCode}"><b>#{c.dim.code}</b><br/></c:if>#{c.dim.name}</td>
                    </c:if>
                </c:forEach>

                <c:choose>
                    <c:when test="#{bnTblTrd.table.dataLoaded}">
                        <c:forEach items="#{r.VDimCellsVisible}" var="vdc">
                            <td class="tdv tdsl#{vdc.row.selected}">#{vdc.valueStr}
                                <div class="gw-balloon-content" style="border-color:#adc9e6;">
                                    <div>
                                        <table style="width:200px;">
                                            <tr style="height:1px;"><th></th><th></th></tr>
                                            <tr><td class="gw-bllb">#{vdc.column.measure.title}:</td><td class="gw-blv">#{vdc.valueStr}</td></tr>
                                            <c:forEach items="#{vdc.column.dimValues}" var="vdcvv">
                                                <c:choose>
                                                    <c:when test="#{vdcvv.tableDimension.showCode}">
                                                        <tr><td class="gw-bllb">#{vdcvv.tableDimension.title}:</td><td class="gw-blv"><b>#{vdcvv.code}</b></td></tr>
                                                        <tr><td class="gw-blv" colspan="2">#{vdcvv.name}</td></tr>
                                                    </c:when>
                                                    <c:otherwise>
                                                        <tr><td class="gw-bllb">#{vdcvv.tableDimension.title}:</td><td class="gw-blv">#{vdcvv.name}</td></tr>
                                                    </c:otherwise>
                                                </c:choose>
                                            </c:forEach>
                                            <c:forEach items="#{vdc.row.HDimCells}" var="vdchv">
                                                <c:choose>
                                                    <c:when test="#{vdchv.dim.tableDimension.showCode}">
                                                        <tr><td class="gw-bllb">#{vdchv.dim.tableDimension.title}:</td><td class="gw-blv"><b>#{vdchv.dim.code}</b></td></tr>
                                                        <tr><td class="gw-blv" colspan="2">#{vdchv.dim.name}</td></tr>
                                                    </c:when>
                                                    <c:otherwise>
                                                        <tr><td class="gw-bllb">#{vdchv.dim.tableDimension.title}:</td><td class="gw-blv">#{vdchv.dim.name}</td></tr>
                                                    </c:otherwise>
                                                </c:choose>
                                            </c:forEach>
                                        </table>
                                    </div>
                                </div></td>
                        </c:forEach>
                    </c:when>

                    <c:otherwise>
                        <c:if test="#{r.index==0}">
                            <td class="tdd gw-pwt-loading" colspan="#{bnTblTrd.table.dataColsCount}" rowspan="#{bnTblTrd.table.dataRowsCount}">

                            </td>
                        </c:if>
                    </c:otherwise>
                </c:choose>

                <c:if test="#{bnTblTrd.table.showRightHeader}">
                    <c:forEach items="#{r.HDimCellsReverse}" var="c">
                        <c:if test="#{c.visible}">
                            <td class="tdd lvl#{c.dim.level} tdsl#{c.row.selected} #{c.dim.tableDimension.css}" rowspan="#{c.dim.rowspan}"><c:if test="#{c.dim.tableDimension.showCode}"><b>#{c.dim.code}</b><br/></c:if>#{c.dim.name}</td>
                        </c:if>
                    </c:forEach>
                </c:if>
            </tr>
        </c:forEach>
    </tbody>
    <tfoot>
        <c:if test="#{bnTblTrd.table.showBottomHeader}">
            <c:forEach items="#{bnTblTrd.table.VDimReverse}" var="vd">
                <tr>
                    <c:if test="#{vd.index==bnTblTrd.table.VDimCount-1}">
                        <c:forEach items="#{bnTblTrd.table.HDim}" var="hd">
                            <c:if test="#{hd.showInTable}">
                                <th class="gw-th gw-pwt-th" rowspan="#{bnTblTrd.table.VDimCount + bnTblTrd.table.measCount}">#{hd.title}</th>
                            </c:if>
                        </c:forEach>
                    </c:if>
                    <c:forEach items="#{vd.iterator}">
                        <c:forEach items="#{vd.values}" var="vdv">
                            <th class="gw-th gw-pwt-th" colspan="#{vdv.colspan}">#{vdv.name}</th>
                        </c:forEach>
                    </c:forEach>
                    <c:if test="#{bnTblTrd.table.showRightHeader}">
                        <c:if test="#{vd.index==bnTblTrd.table.VDimCount-1}">
                            <c:forEach items="#{bnTblTrd.table.HDimReverse}" var="hd">
                                <c:if test="#{hd.showInTable}">
                                    <th class="gw-th gw-pwt-th" rowspan="#{bnTblTrd.table.VDimCount + bnTblTrd.table.measCount}">#{hd.title}</th>
                                </c:if>
                            </c:forEach>
                        </c:if>
                    </c:if>
                </tr>
            </c:forEach>
            <c:if test="#{bnTblTrd.table.measCount>0}">
                <tr>
                    <c:forEach items="#{bnTblTrd.table.meas}" var="m">
                        <c:if test="#{m.showInTable}">
                            <th class="gw-th gw-pwt-th" colspan="#{m.colspan}">#{m.title}</th>
                        </c:if>
                    </c:forEach>
                </tr>
            </c:if>
        </c:if>
    </tfoot>
</table>